<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="edge">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1.0,user-scalable=0">
    <meta content="telephone=no" name="format-detection" />
    <meta name="description" content="">
	<meta name="keywords" content="">
    <title>知识库-文本框</title>
    <link rel="stylesheet" type="text/css" href="css/reset.css">
    <link rel="stylesheet" type="text/css" href="css/global.css">
    <link rel="stylesheet" type="text/css" href="css/media.css">
    <style type="text/css">
		html,body{ background-color: #fff;}
    </style>
</head>
<body>
    <!-- 头部 -->
    <header class="header">
        <a href="javascript:history.go(-1);" title="返回" class="icon back"></a>
        <h1></h1>
        <a href="javascript:void(0);"  onclick="addComment();return false;" title="发送" class="text">发送</a>
    </header>

    <!-- 文本框 -->
    <section class="padT23">
    	<textarea placeholder="想说什么" class="textBox" id="comment" ></textarea>
    </section>
    
    <script type="text/javascript" src="js/lib/jquery.min.js"></script>
    <script type="text/javascript" src="js/lib/vue.js"></script>
    <script type="text/javascript" src="js/lib/global.js"></script>
    <script type="text/javascript" src="js/lib/alert.js"></script>
    <script type="text/javascript" src="js/lib/common.js"></script>
    
    <script type="text/javascript">
        var dataID = $.getUrlVar("uid");
        function addComment(){
            var comment = $("#comment").val();
            if(comment==""){
                alert("请输入内容");
                return;
            }
            var data = {
                uid: dataID,
                comment :comment
            };
            data = Common.jsonEncode(data);
            Common.ajaxCall({ url: 'look_addLetter', datatype: 'json', type: 'post', data: data}, function (data) {
                if(data.error_code==0){
                    alert(data.msg);
                    //延迟跳转
                    setTimeout(function(){ window.history.go(-1);},1000);
                }else{
                    alert(data.msg);
                }
            });
        }

        //$("#comment").focus();

        $('.textBox').blur(function(){
            if($(this).val().length > 0){

                $(this).addClass('full');
            }else{
                $(this).removeClass('full');
            }
        });
    </script>
</body>
</html>